package nc.ui.erm.tj;

import nc.lfw.billtemplate.delegator.IBusinessDelegator;
import nc.lfw.billtemplate.processor.DefaultBillTemplateProcessor;
import nc.lfw.data.Dataset;
import nc.lfw.data.PaginationInfo;
import nc.lfw.util.LfwClassUtil;
import nc.md.data.access.NCObject;
import nc.md.model.IBusinessEntity;
import nc.vo.pub.BusinessException;

public class TjQbProcessor extends DefaultBillTemplateProcessor {

	@Override
	protected IBusinessDelegator createBusiDelegator() {
		String delegator = TjQbDelegator.class.getName();
		return (IBusinessDelegator) LfwClassUtil.newInstance(delegator);
	}

	@Override
	protected NCObject[] doBillLoad(IBusinessEntity entity)
			throws BusinessException {
		TjQbDelegator delegator =  new TjQbDelegator();
		Dataset ds = this.getWebContext().getPageMeta().getViewModel().getDataset("todolists_TodoListVO");
		PaginationInfo pInfo = null;
		if(ds != null){
			pInfo = ds.getPaginationInfo();	
		}
		NCObject[] s = delegator.queryHeadAllData(entity,
				 "",  " 1=1 ", pInfo);;
		
		return s;
	}

	private TjQbDelegator getDelegator() {
		TjQbDelegator delegator = (TjQbDelegator) this.billHandler;
		return delegator;
	}
}
